﻿using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;

using Toom.CellularAutomata.Model;


namespace Toom.CellularAutomata.Model.Tests
{
	[TestClass]
	public class UnitTestForCAField
	{
		[TestMethod]
		public void TestSetAndGetData()
		{
			//int sizeX=10;
			//int sizeY=10;
			CAField field = new CAField( 10, 10 );

			// first, prep my own reference
			int[,] myData = new int[10, 10];
			Random rnd = new Random();
			for ( int x=0 ; x<10 ; x++ )
				for ( int y=0 ; y<10 ; y++ )
				{
					int val = rnd.Next( 0, 10 );
					myData[x, y] = val;
					field.SetDataAt( x, y, val );
					Assert.AreEqual( field.GetDataAt( x, y ), val );
				}

			// recheck 
			for ( int x=0 ; x<10 ; x++ )
				for ( int y=0 ; y<10 ; y++ )
					Assert.AreEqual( field.GetDataAt( x, y ), myData[x, y] );

			
		}
	}
}
